<!DOCTYPE html>
<html lang="en" style="background:#fff;">
<head>
    <base href="${basePath}">
    <#include "common/top.html"/>
</head>
<body style="background:#fff;">
<style>
    .layui-form-select dl {
        width: 200px;
    }

</style>
<form class="layui-form" modelAttribute="pRole" name="form1" id="form1" method="post">
    <input type="hidden" name="roleId" id="roleId" value="${pRole.roleId}"/>
    <div class="layui-form-item layui-form-item-dialog">
        <label class="layui-form-label"><span style="color: red;">*</span>角色名称：</label>
        <div class="layui-input-inline">
            <input class="layui-input" type="text" name="roleName" id="roleName" placeholder="请输入角色名称"
                   value="${pRole.roleName}"/>
        </div>
    </div>
    <div class="layui-form-item layui-form-item-dialog">
        <label class="layui-form-label"><span style="color: red;">*</span>角色描述：</label>
        <div class="layui-input-inline">
            <textarea style="width: 200px" class="layui-textarea"  type="text" name="descb" id="descb" placeholder="请输入角色描述"   title="公告内容">${pRole.descb}</textarea>
        </div>
    </div>
</form>
</body>
<script type="text/javascript">

    var $form;
    var form;
    layui.use(['form', 'layedit', 'laydate'], function () {
        form = layui.form();
        debugger;
        $("#comCode option").each(function () {
            if ($(this).val() == "${sysRole.comCode}") {
                $(this).attr("selected", true);
            }
        });
        form.render();
    });
    //保存
    function save() {
        if (checkIsNull("roleName", "请输入角色名称") ) {
            return false;
        }


       var userid = "${rolef}";

        /**
         * 如果不是超级管理员权限
         */
     /*  if(userid!="admin"){
           if( checkIsNull("comCode","请选择企业名称")){
                 return false;
           }
       }
*/

        $.ajax({
            url: "${basePath}/merchant/mcrole/saveUpdateRole",
            data: $("#form1").serialize(),
            type: "POST",
            success: function (data) {
                if (data.status == 'success') {
                    parent.layer.alert(data.msg, function (index) {
                        var index1 = parent.layer.getFrameIndex(window.name); //获取窗口索引
                        parent.layer.close(index1);
                        parent.layer.close(index);
                    });
                } else {
                    parent.layer.alert(data.msg);
                }
            }
        })
    }
</script>
</html>


